<?php include "menu.phtml"; ?>
<div id="right">
	<div class="rightbox">
		<div class="context"><div class="in"><a href="javascript:void(0);" id="context_menu" class="icon_link the_down"><span></span></a></div></div>
		<h1><?php echo $this->translate->_("Subentry Pictures"); ?></h1>
		<br />
		<?php if(isset($this->up['errors']) && count($this->up['errors']) > 0):?>
			<div class="c_error">
				<?php foreach($this->up['errors'] as $idx => $error): ?>
					<div><b><?php echo $idx; ?></b></div>
					<ul>
						<?php foreach($error as $item): ?>
							<li><?php echo $item; ?></li>
						<?php endforeach; ?>
					</ul>
				<?php endforeach; ?>
			</div>
			<br />
		<?php endif; ?>
		<?php if(isset($this->up['success']) && count($this->up['success']) > 0):?>
			<div class="c_success">
				<ul>
					<?php foreach($this->up['success'] as $idx => $success): ?>
						<li><?php echo $idx; ?> <?php echo $this->translate->_("was successfully uploaded"); ?>.</li>
					<?php endforeach; ?>
				</ul>
			</div>
			<br />
		<?php endif; ?>
		<?php echo $this->form; ?>
		<?php if(count($this->gallery) > 0) :?>
			<hr />
			<div class="gallery">
				<?php foreach($this->gallery as $idx => $picture): ?>
					<?php $url = $this->url(array('controller'=>'pets', 'action'=>'files', 'download' => $picture->getId()), 'default', true); ?>
					<div class="picture" rel="<?php echo $picture->getId(); ?>">
						<a href="<?php echo $url; ?>" target="_parent">
							<span class="img" style="background: #000 url('/images/userfiles/pets/<?php echo $this->pet->getId(); ?>/diary records/<?php echo $this->subentry->getDiaryRecord()->getTitle(); ?>/<?php echo $this->subentry->getDate(); ?>/thumb_<?php echo $picture->getFile(); ?>') center center no-repeat;">
							</span>
						</a>
						<span class="name ellipsis">
							<a href="<?php echo $url; ?>" target="_parent"><?php echo pathinfo($picture->getDescription(), PATHINFO_FILENAME); ?></a>
						</span>
						<span class="links">
							<a href='<?php echo $this->url(array('controller'=>'diary', 'action'=>'pictures-subentry', 'id'=>$this->subentry->getId(), 'remove'=>$picture->getId()), 'default', true); ?>' class='icn delete reqconf' title='<?php echo $this->translate->_("Delete Picture"); ?>?'>&nbsp;</a>
							<a href='<?php echo $this->url(array('controller'=>'diary', 'action'=>'pictures-subentry', 'id'=>$this->subentry->getId(), 'primary'=>$picture->getId()), 'default', true); ?>' class='icn accept reqconf' title='<?php echo $this->translate->_("Make Picture Primary"); ?>?'>&nbsp;</a>
						</span>
						<?php if($idx == 0): ?>
							<div class="primary">
								<span title="<?php echo $this->translate->_("primary"); ?>"><?php echo $this->translate->_("primary"); ?></span><br />
							</div>
						<?php endif; ?>
					</div>
				<?php endforeach; ?>
				<div class="clear"></div>
			</div>
			<div class="clear"></div>
		<?php endif; ?>
		<hr />
		<div class="left"><input onclick="Petolio.go(window.location.href.replace('pictures', 'edit'));" type="button" value="<?php echo $this->translate->_("< Go Back to Subentry Details"); ?>" id="submit" name="prev" style="margin: 0px;"><div class="clear"></div></div>
		<div class="right"><input onclick="Petolio.go(window.location.href.replace('pictures', 'videos'));" type="button" value="<?php echo $this->translate->_("Go to Videos >"); ?>" id="submit" name="next"><div class="clear"></div></div>
		<div class="clear"></div>
	</div>
</div>